﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using Maticsoft.Common;
using LTP.Accounts.Bus;
namespace NCEdu.Web.gradeInfo
{
    public partial class Add : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
                       
        }

        		protected void btnSave_Click(object sender, EventArgs e)
		{
			
			string strErr="";
			if(!PageValidate.IsNumber(txtGradeInfoId.Text))
			{
				strErr+="GradeInfoId格式错误！\\n";	
			}
			if(this.txtgradeName.Text.Trim().Length==0)
			{
				strErr+="gradeName不能为空！\\n";	
			}
			if(this.txtgradeMaster.Text.Trim().Length==0)
			{
				strErr+="gradeMaster不能为空！\\n";	
			}
			if(!PageValidate.IsDateTime(txtgradeTime.Text))
			{
				strErr+="gradeTime格式错误！\\n";	
			}

			if(strErr!="")
			{
				MessageBox.Show(this,strErr);
				return;
			}
			int GradeInfoId=int.Parse(this.txtGradeInfoId.Text);
			string gradeName=this.txtgradeName.Text;
			string gradeMaster=this.txtgradeMaster.Text;
			DateTime gradeTime=DateTime.Parse(this.txtgradeTime.Text);

			NCEdu.Model.gradeInfo model=new NCEdu.Model.gradeInfo();
			model.GradeInfoId=GradeInfoId;
			model.gradeName=gradeName;
			model.gradeMaster=gradeMaster;
			model.gradeTime=gradeTime;

			NCEdu.BLL.gradeInfo bll=new NCEdu.BLL.gradeInfo();
			bll.Add(model);
			Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功！","add.aspx");

		}


        public void btnCancle_Click(object sender, EventArgs e)
        {
            Response.Redirect("list.aspx");
        }
    }
}
